import numbers
class IntField(object):
    def __get__(self, instance, owner):
        return self.value

    def __set__(self, instance, value):
        if not isinstance(value,numbers.Integral):
            raise ValueError('int object is needed')
        if value<0:
            raise ValueError('positive value is deeded')
        self.value=value

    def __delete__(self, instance):
        pass
class Module:
    age=IntField()

my_module=Module()
my_module.age=10
print(my_module.age)


lst=[{'did':9004,'title':'教学部'},
                {'did':9002,'title':'品保部'},
                {'did':9003,'title':'销售部'},
                {'did':9006,'title':'销售部'},
                {'did':9000,'title':'销售部'}]
print(sorted(lst,key=lambda x:x['did']))
def func():
    for i in range(len(lst)):
        for j in range(i,len(lst)):
            if lst[i]['did']>lst[j]['did']:
                lst[i],lst[j]=lst[j],lst[i]
    return lst
res=func()
print(res)